feat: Allow not sending evaluation event when evaluating a flag#390
feat: Allow not sending evaluation event when evaluating a flag#390pranjalv123 wants to merge 2 commits intolaunchdarkly:mainfrom
Conversation
|
@pranjalv123 can you share a little more about your use case? Are you wanting to have this available in your production app where some flag evaluations send events and others do not, or for an internal app where you can evaluate all flags without sending events? We do support disabling events via the config (send_events) but it is a global option and I'm unsure if that would meet your needs. |
Yes, it's this. We primarily use this for internal tooling/analytics, but because we want to calculate the launchdarkly context exactly the same way as we do in our production app, it's easiest to do the evaluation from our production app. I can imagine a world where we initialize a separate client to do the non-tracking evaluations, but that would have some overhead in terms of redis connections (for relay proxy in daemon mode), memory usage, complexity, etc. |
Requirements
Describe the solution you've provided
We'd like to be able to evaluate a flag without sending an evaluation event to LaunchDarkly. This is useful, for example, for internal tooling that helps debug issues by listing the value of a flag for a particular context. We don't want to send an evaluation event to LD because it doesn't constitute a "real" evaluation so we don't want to consider it as evidence that a flag is still being evaluated and shouldn't be cleaned up.
Describe alternatives you've considered
all_flags_state, but that's a much more expensive operation, and doesn't allow us to pass custom contexts on a per-flag basisNote
Adds a per-call
send_eventsflag tovariation/variation_detailto evaluate without emitting events, with internal wiring and a test.send_eventsoptional parameter (defaultTrue) toLDClient.variationandLDClient.variation_detailto allow evaluating flags without emitting analytics events.send_eventsthrough_evaluate_internal, gating all event emissions (new_unknown_flag_event, evaluation result events, and default events).test_no_event_when_send_events_falseverifying no events are produced whensend_events=False.Written by Cursor Bugbot for commit c9d92a7. This will update automatically on new commits. Configure here.